package com.tian.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.tian.dao.UserMapper;
import com.tian.entity.Emp;
import com.tian.entity.User;
import com.tian.service.UserService;
import com.tian.util.OssUtils;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author: Tian
 * @version: 1.0
 * @since: 1.0
 * @date: 2024/3/6/16:19
 */
@Service
public class UserServiceImpl implements UserService {
    @Resource
    private UserMapper userMapper;

    @Override
    public PageInfo<User> selectAll(Integer current,Integer pageSize) {
        PageHelper.startPage(current,pageSize);
        List<User> users = userMapper.selectAll(current,pageSize);
        PageInfo<User> pageInfo=new PageInfo<>(users);
        return pageInfo;
    }

    @Override
    public int insertUser( User user) {
        int count = userMapper.insert(user);
        return count;
    }

    @Override
    public User selectById(Long id) {
        User user = userMapper.selectByPrimaryKey(id);
        return user;

    }

    @Override
    public int update(User user) {
        int count = userMapper.updateByPrimaryKey(user);
        return count;
    }

    @Override
    public int deleteById(Long id) {
        int count= userMapper.deleteByPrimaryKey(id);
        return count;
    }


}
